@extends('dashboard.base')

@section('content')
<div class="card-header"><a href="{{route('admin.bottomnav.create')}}" class="btn btn-square  btn-info active">添加导航</a></div>
<table class="table table-responsive-sm">
      <thead>
        <tr>
          <th>导航名称</th>
          <th>排序</th>
          <th>链接</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
       @foreach($datas as $v)
        <tr>
          <td class="font-weight-bold">{{ $v->name }}</td>
          <td>{{ $v->sort }}</td>
          <td>{{ $v->link }}</td>
          <td>
            <a href="{{route('admin.bottomnav.edit', $v)}}" class="badge badge-info text-white">编辑</a>
                 <a class="badge badge-danger text-white" data-url="{{route('admin.bottomnav.destroy', $v)}}">删除
                 </a>
                 <a class="badge badge-info text-white" href="{{ route('admin.bottomnav.create', ['pid' => $v->id]) }}">添加子导航</a>
          </td>
        </tr>
        @if($v->subnavs)
          @foreach($v->subnavs as $v1)
            <tr class="pl-3">
              <td>&nbsp;&nbsp;{{ $v1->name }}</td>
              <td>{{ $v1->sort }}</td>
              <td>{{ $v1->link }}</td>
              <td>
                 <a href="{{route('admin.bottomnav.edit', $v1)}}" class="badge badge-info text-white">编辑</a>
                 <a class="badge badge-danger text-white" data-url="{{route('admin.bottomnav.destroy', $v1)}}">删除
                 </a>
              </td>
            </tr>
          @endforeach
        @endif
       @endforeach
      </tbody>
    </table>
@endsection